package net.jescort.web.servlet.controller.topic;

import net.jescort.domain.forum.Topic;
import org.apache.commons.lang.StringUtils;
import org.springframework.validation.Errors;

public class TopicValidator
{
    public void validate(Topic topic, Errors errors)
    {
        if (StringUtils.isBlank(topic.getSubject()))
        {
            errors.rejectValue("subject", "required", "required");
        }
        if (StringUtils.isBlank(topic.getContent()))
        {
            errors.rejectValue("content", "required", "required");
        }
    }
}
